package app.qrcode.browser.todoapp.data

import androidx.room.TypeConverter
import app.qrcode.browser.todoapp.data.models.Priority
import app.qrcode.browser.todoapp.data.models.TaskStatus

/**
 * Created by YiGo on 2022/5/6.
 */
class Converter {
    @TypeConverter
    fun fromPriority(priority: Priority): String {
        return priority.name
    }

    @TypeConverter
    fun toPriority(priority: String): Priority {
        return Priority.valueOf(priority)
    }

    @TypeConverter
    fun fromTaskStatus(taskStatus: TaskStatus): String {
        return taskStatus.name
    }

    @TypeConverter
    fun toTaskStatus(taskStatus: String): TaskStatus {
        return TaskStatus.valueOf(taskStatus)
    }
}